#!/bin/sh

echo "Run this from the crosslight etc/ssl directory.";

SITE="ssl_example.localhost"

cd etc/ssl
openssl genrsa -des3 -out $SITE.key 1024  #Build our key
openssl req -new -key $SITE.key -out $SITE.csr #Build the cert request
cp $SITE.key{,.orig} 
openssl rsa -in $SITE.key.orig -out $SITE.key #Ignore the passphrase
openssl x509 -req -days 365 -in $SITE.csr -signkey $SITE.key -out $SITE.crt #Build the cert
cat $SITE.key $SITE.crt > $SITE.pem #Build the pem
sed -i 's/^#\(include "ssl\/lighttpd.ssl.conf"\)/\1/' etc/lighttpd.conf
